

package com.kimo.shop.service.impl;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kimo.shop.bean.param.PayTopParam;
import com.kimo.shop.bean.param.ProdAnalysisSurveyParam;
import com.kimo.shop.common.util.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kimo.shop.bean.model.OrderItem;
import com.kimo.shop.dao.OrderItemMapper;
import com.kimo.shop.service.OrderItemService;

/**
 * @author kimo-taozhouchuan on 2018/09/15.
 */
@Service
public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem> implements OrderItemService {

    @Autowired
    private OrderItemMapper orderItemMapper;

    @Override
//    @Cacheable(cacheNames = "OrderItems", key = "#orderNumber")
    public List<OrderItem> getOrderItemsByOrderNumber(String orderNumber, Integer dbLang) {
        return orderItemMapper.listByOrderNumber(orderNumber,dbLang);
    }

//    @Override
//    public List<OrderItem> getUnCloseRefundOrderItemByOrderNumberAndUserId(String orderNumber, String userId) {
//        return orderItemMapper.getUnCloseRefundOrderItemByOrderNumberAndUserId(orderNumber, userId);
//    }
    @Override
    public IPage<PayTopParam> getPayAmounts(PageParam<OrderItem> page, ProdAnalysisSurveyParam param, Integer dbLang) {
        IPage<PayTopParam> resPage = orderItemMapper.getPayAmounts(page, param, dbLang);
        return resPage;
    }

    @Override
    public Integer getPayPersonNumByParam(Integer prodId, Long shopId, Date startTime, Date endTime) {
        return orderItemMapper.getPayPersonNumByParam(prodId,shopId,startTime,endTime);
    }

    @Override
    public void insertBatchOrderItem(List<OrderItem> orderItems) {
        saveBatch(orderItems);
        orderItemMapper.insertBatchOrderItemLang(orderItems);
    }

}
